package com.cx.controller;

import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * @Author cenxi
 * @Date 2023/11/4 16:11
 * @Version 1.0
 */
@RequestMapping("/jenkins")
@RestController
@Slf4j
public class JenkinsController {

    @GetMapping("/enable/{name}")
    public String enable(@PathVariable("name") String name) {
        log.info("jenkins打包成功: {}", name);
        return "jenkins打包成功---(- -): " + name;
    }

    @GetMapping("/enable")
    public String enable(HttpServletRequest request, HttpServletResponse response) {
        String header = request.getHeader("X-Real-IP");
        String domain = request.getHeader("domain");
        response.setHeader("X-Real-IP", header);
        response.setHeader("domain", domain);
        log.info("地址: domain: {}, {}", header, domain);
        return "地址---(- -): " + header + "domain: " + domain;
    }


}
